cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

project(AmbientSpheres)

find_package(VTK COMPONENTS 
  CommonColor
  CommonCore
  FiltersSources
  InteractionStyle
  RenderingContextOpenGL2
  RenderingCore
  RenderingFreeType
  RenderingGL2PSOpenGL2
  RenderingOpenGL2
)

if (NOT VTK_FOUND)
  message(FATAL_ERROR "AmbientSpheres: Unable to find the VTK build folder.")
endif()

# Prevent a "command line is too long" failure in Windows.
set(CMAKE_NINJA_FORCE_RESPONSE_FILE "ON" CACHE BOOL "Force Ninja to use response files.")
# add_executable(AmbientSpheres MACOSX_BUNDLE render.cxx )
# add_executable(colorSpheres MACOSX_BUNDLE colorSphere.cxx )
add_executable(colorcube MACOSX_BUNDLE colorCube.cxx )

# target_link_libraries(AmbientSpheres PRIVATE ${VTK_LIBRARIES})
# target_link_libraries(colorSpheres PRIVATE ${VTK_LIBRARIES})
target_link_libraries(colorcube PRIVATE ${VTK_LIBRARIES})


# vtk_module_autoinit is needed
# vtk_module_autoinit(
#   TARGETS AmbientSpheres
#   MODULES ${VTK_LIBRARIES}
# )
# vtk_module_autoinit(
#   TARGETS colorSpheres
#   MODULES ${VTK_LIBRARIES}
# )
vtk_module_autoinit(
  TARGETS colorcube
  MODULES ${VTK_LIBRARIES}
)